<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>

<html lang="en">

<head>

  <meta charset="utf-8">

  <title>开盘红股票交易系统-卖出委托</title>

  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  <link rel="stylesheet" href="css/bootstrap.css">

  <link rel="stylesheet" href="css/font-awesome.min.css">

  <link rel="stylesheet" href="css/style.css">

  <link rel="stylesheet" href="css/plugin.css">

  <link rel="stylesheet" href="css/landing.css">

  <!--[if lt IE 9]>

  <script src="js/ie/respond.min.js"></script>

  <script src="js/ie/html5.js"></script>

  <![endif]-->

  <script src="js/jquery.min.js"></script>

  <!-- Bootstrap -->

  <script src="js/bootstrap.js"></script>

  <!-- app -->

  <script src="js/app.js"></script>

  <script src="js/app.plugin.js"></script>

  <script src="js/app.data.js"></script>
  <!-- / footer -->

  <script src="js/jquery.min.js"></script>

  <!-- Bootstrap -->

  <script src="js/bootstrap.js"></script>

  <!-- app -->

  <script src="js/app.js"></script>

  <script src="js/app.plugin.js"></script>

  <script src="js/app.data.js"></script>

  <!-- Sparkline Chart -->

  <script src="js/charts/sparkline/jquery.sparkline.min.js"></script>

  <script src="js/ie/excanvas.js"></script>

  <!-- Easy Pie Chart -->

  <script src="js/charts/easypiechart/jquery.easy-pie-chart.js"></script>

  <!--Datatables-->
  <script src="js/datatables/jquery.dataTables.js"></script>
  <link rel="stylesheet" type="text/css" href="css/datatables/jquery.dataTables.css">
  <script type="text/javascript" src="js/datatables/dataTables.bootstrap4.js"></script>

  <!--SweetAlert-->
  <script src="js/sweetalert/sweet-alert.js"></script>
  <link rel="stylesheet" type="text/css" href="js/sweetalert/sweet-alert.css">
  <script type="text/javascript">
    $(document).ready(function() {
      $("#ChangeBtn").click(function() {
        if($("#InputOldPassWord").val()=="")
        {
          swal({
            title:"注意",
            text:"旧密码不得为空",
            timer:"1000"
          })
          return;
        }
        else if($("#InputNewPassWord").val()=="")
        {
          swal({
            title:"注意",
            text:"新密码不得为空",
            timer:"1000"
          })
          return;
        }
        else if($("#InputNewPassWord").val() != $("#InputConfirmNewPassWord").val())
        {

          swal({
            title:"注意",
            text:"两次输入的密码不相等",
            timer:"1000"
          })
          return;
        }
        else{
          let postdata={
            "PassWord": $("#InputNewPassWord").val(),
            "OldPassWord":$("#InputOldPassWord").val()};
          $.ajax({
            url: 'http://localhost:6060/StockTrade_war/API/User/ChangePw',
            type: 'post',
            contentType:"application/json;charset=utf-8",
            data: JSON.stringify(postdata),
            async: false, //是否异步提交,默认为true
            dataType: 'json', //提交的数据格式为JSON,返回的数据格式也是json
            success: function(resp) {
              if(resp.errorCode != "修改密码成功")
              {
                swal({
                  title:"注意",
                  text:resp.errorCode,
                  timer:"2000"
                })
              }
              else
              {
                swal({
                          title:"提示",
                          text:resp.errorCode,
                          confirmButtonColor: "#CCCCCC",
                          confirmButtonText: "确定"
                        })
              }
            },
            error: function(resp) {
              swal({
                title:"错误",
                text:"请联系管理员处理",
                timer:"1000"
              })
            }
          })
        }
      })
    })
  </script>
</head>

<body>

<!-- header -->

<header id="header" class="navbar">

  <ul class="nav navbar-nav navbar-avatar pull-right">

    <li class="dropdown">

      <a href="#" class="dropdown-toggle" data-toggle="dropdown">

        <span class="hidden-sm-only" id="Username">Mika Sokeil</span>

        <b class="caret hidden-sm-only"></b>

      </a>

      <ul class="dropdown-menu">

        <li><a href="#">设置</a></li>

        <li><a href="#">个人信息</a></li>


        <li class="divider"></li>

        <li><a href="index.jsp">Logout</a></li>

      </ul>

    </li>

  </ul>

  <a class="navbar-brand" href="#">开盘红股票交易系统</a>


</header>
<!-- / header -->

<!-- nav -->
<nav id="nav" class="nav-primary visible-lg nav-vertical">

  <ul class="nav" data-spy="affix" data-offset-top="50">

    <li><a href="main.jsp"><i class="icon-dashboard icon-xlarge"></i>首页</a></li>

    <li class="dropdown-submenu">

      <a href="#"><i class="icon-th icon-xlarge"></i>股票交易</a>

      <ul class="dropdown-menu">

        <li><a href="stocktrade.jsp">股票交易</a></li>
        <li><a href="trade.jsp">交易记录</a></li>

      </ul>

    </li>

    <li class="dropdown-submenu">

      <a href="#"><i class="icon-list icon-xlarge"></i>开户</a>

      <ul class="dropdown-menu">

        <li><a href="open.jsp">提交开户信息</a></li>

        <li><a href="openresult.jsp">查询开户结果</a></li>

      </ul>

    </li>

    <li class="dropdown-submenu active">

      <a href="#"><i class="icon-link icon-xlarge"></i>其他操作</a>

      <ul class="dropdown-menu">

        <li class="active"><a href="changepw.jsp">修改密码</a></li>

        <li><a href="index.jsp">退出登陆</a></li>

      </ul>

    </li>

  </ul>

</nav>

<!-- / nav -->

<section id="content">

  <section class="main padder">

    <div class="clearfix">

      <h4>修改密码</h4>

    </div>
    <div class="row">

      <div class="col">
        <section class="panel">

          <form class="form-horizontal" data-validate="parsley" onsubmit="return false">


            <div class="form-group">

              <label class="col-lg-3 control-label">旧的密码</label>

              <div class="col-lg-8">

                <input type="password" id="InputOldPassWord" placeholder="旧的密码" class="form-control"  required>

              </div>

            </div>
            <div class="form-group">

              <label class="col-lg-3 control-label">新的密码</label>

              <div class="col-lg-8">

                <input type="password" id="InputNewPassWord" placeholder="新的密码" class="form-control"  required>

              </div>

            </div>
            <div class="form-group">

              <label class="col-lg-3 control-label">确认密码</label>

              <div class="col-lg-8">

                <input type="password" id="InputConfirmNewPassWord" placeholder="确认密码" class="form-control" required>

              </div>

            </div>

            <div class="form-group">

              <div class="col-lg-9 col-offset-3">

                <button class="btn btn-large" id="ChangeBtn">确定</button>

              </div>

            </div>

          </form>

        </section>
      </div>

    </div>

  </section>

</section>

<!-- .modal -->

</body>

</html>